﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using RBS.Core.BLL;

namespace RBS.Web.Hotel.Controllers
{
    public class AreaController : Controller
    {
        //
        // GET: /Area/

        public readonly RBS.Core.BLL.SYS_Province BllProvince = new SYS_Province();
        public readonly RBS.Core.BLL.SYS_City BllCity = new SYS_City();
        public readonly RBS.Core.BLL.SYS_County BllCounty = new SYS_County();  
      
        public JsonResult GetProvince()
        {
            var modelList = BllProvince.GetModelList(""); 
            return Json(modelList,JsonRequestBehavior.AllowGet);
        } 
        public JsonResult GetCity(string id)
        {
            var modelList = BllCity.GetModelList(" Provinceid=(select id from SYS_Province where Provincename='" + id + "') ");
            return Json(modelList,JsonRequestBehavior.AllowGet);
        } 
        public JsonResult GetCounty( string  id)
        {
            var modelList = BllCounty.GetModelList(" cityid=(select id from SYS_City where Cityname='" + id + "') ");
            return Json(modelList,JsonRequestBehavior.AllowGet);
        } 
    }
}
